feat: Add aw87xxx codec for AyaNeo/Ayn/Orange Pi handheld speaker amplifiers - #102
Conversation
|
Companion PR enabling this in the build config: OpenGamingCollective/kernel-packages#36 — |
|
Are we planning to upstream this, or rework it before hand? Authorship makes it somewhat of a challenge. |
CONFIG_SND_SOC_AW87XXX is added by OpenGamingCollective/linux#102. Enable it as a module so it's actually built. Signed-off-by: Hijae Song <hijae@naver.com>
|
For the AYANEO Air 1S another quirk in the ALC269 codec is necessary to fix audio output. I commented on the initial bug report in @hijae Do you want to include a fix for that in this PR as well or should this be done via a separate PR? Working patch to fix audio output on the AYANEO Air 1SI went back and forth with an LLM to write this, but I am neither a kernel contributor nor am I experienced in C. I understand the code, but I do not understand why This fix is should even be safer than the upstream one as we are only targeting the Air 1S specifically. diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index cae327e1d9..390bf19966 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -3998,6 +3998,7 @@
ALC269VB_FIXUP_ASUS_ZENBOOK,
ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE,
+ ALC269_FIXUP_AYANEO_AIR_1S,
ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
ALC269VB_FIXUP_ORDISSIMO_EVE2,
ALC283_FIXUP_CHROME_BOOK,
@@ -4299,6 +4300,19 @@
ALC285_LENOVO_DAC_RENAME,
};
+static void alc269_fixup_ayaneo_air_1s(struct hda_codec *codec,
+ const struct hda_fixup *fix, int action)
+{
+ if (action != HDA_FIXUP_ACT_PRE_PROBE)
+ return;
+
+ if (!dmi_match(DMI_SYS_VENDOR, "AYANEO") ||
+ !dmi_match(DMI_PRODUCT_NAME, "AIR 1S"))
+ return;
+
+ snd_hda_codec_set_pincfg(codec, 0x1a, 0x90170110);
+}
+
/* A special fixup for Lenovo C940 and Yoga Duet 7;
* both have the very same PCI SSID, and we need to apply different fixups
* depending on the codec ID
@@ -4530,6 +4544,10 @@
{ }
},
},
+ [ALC269_FIXUP_AYANEO_AIR_1S] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = alc269_fixup_ayaneo_air_1s,
+ },
[ALC269_FIXUP_AMIC] = {
.type = HDA_FIXUP_PINS,
.v.pins = (const struct hda_pintbl[]) {
@@ -8213,6 +8231,7 @@
SND_PCI_QUIRK(0x1f4c, 0xb020, "Minisforum AI X1 Pro",
ALC245_FIXUP_MINISFORUM_JACK_DETECT),
SND_PCI_QUIRK(0x1f4c, 0xe001, "Minisforum V3 (SE)", ALC245_FIXUP_BASS_HP_DAC),
+ SND_PCI_QUIRK(0x1f66, 0x0103, "AYANEO AIR 1S", ALC269_FIXUP_AYANEO_AIR_1S),
SND_PCI_QUIRK(0x1f66, 0x0105, "Ayaneo Portable Game Player", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x2014, 0x800a, "Positivo ARN50", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
SND_PCI_QUIRK(0x2039, 0x0001, "Inspur S14-G1", ALC295_FIXUP_CHROME_BOOK), |
|
@bl1nk |
|
We'll most likely carry this patch as it is needed for many devices. The authorship issue is administrative. I asked bl1nk to see if you could cherry-pick that patch as well. It will depend on these being merged so it makes it simpler to include. |
|
Thanks for tracking this down and for the fix! I found the original source for this — it's already in hhd-dev/patchwork (89eb9630d9, authored by fewtarius, co-developed by linh1987, carried by Antheas) — so I ported that version instead of yours: it's simpler (a static pin table, no runtime DMI check needed) and keeps clean original authorship. Pushed as a third commit on this PR, same pin/value you verified (0x1a → 0x90170110). I don't have an AIR 1S myself, so if you get a chance to confirm this exact commit works on your hardware, that'd be great before it merges. |
|
IIRC the mini pro and the air 1s have inverted pin configurations or something similar that necessitated the DMI match but I'm not certain what it exactly was. Hopefully we can find a mini pro user to test as well |
9ffbc89 to
1fb2b66
Compare
|
Thank you both, again. I built both modules and loaded them against the current -testing kernel and everything worked just fine (after restarting steam, so it could pick up the new pipewire sink, I think). If anyone wants to try it out on their device(s) to see if it breaks on something that is not the AYANEO Air 1SClone the kernel repo: Set some variables: Then build the patched modules. Realtek codec modules: AW87xxx amplifier driver: The relevant resulting modules are: Optional check: should return something like: to verify that the compiled module contains the fix. Temporarily disable PipeWire/WirePlumber: Check that nothing still has the ALSA devices open: (it should return nothing) Unload the existing HDA modules: Load the patched modules: You should be able to play a sound now: Reboot to reset the device to its previous state. |
pastaq
left a comment
There was a problem hiding this comment.
This is pulling in unrelated changes. Please rebase and don't merge in a separate feature branch.
While rebasing, ensure each patch is tagged [NOT-FOR-UPSTREAM] in the commit title and the cherry pick sha is included by running cherry-pick -sex for each sha
…ntation Contribution by CVMagic (https://github.com/CVMagic) aw87xxx: Use strscpy instead of strlcpy awinic: i2c_driver cleanup and fixes This is deliberately an OGC-carried patch and must not be sent upstream. (cherry picked from commit 91a51cacadb95ba80227663a75fd113552b18e45) Signed-off-by: Hijae Song <hijae@naver.com>
…gging purposes, but also fixed Reset Pin GPIO initialization issue with Ayn Loki Mini This is deliberately an OGC-carried patch and must not be sent upstream. (cherry picked from commit 4b4179efc86828f8762f0819aabf4413a3ba0d27) Signed-off-by: Hijae Song <hijae@naver.com>
…a second I2C chip if specified in ACPI This is deliberately an OGC-carried patch and must not be sent upstream. (cherry picked from commit ed123302c7dde72a935052370de4a9b2ff3e1feb) Signed-off-by: Hijae Song <hijae@naver.com>
…sume. This is deliberately an OGC-carried patch and must not be sent upstream. (cherry picked from commit 92392036d95ffdf9fc2b4b42c3dd31a8939d4027) Signed-off-by: Hijae Song <hijae@naver.com>
This is deliberately an OGC-carried patch and must not be sent upstream. (cherry picked from commit dac32102659fa0ae4f2692ed81810ceb834ed584) Signed-off-by: Hijae Song <hijae@naver.com>
Multiple AyaNeo/Ayn/Orange Pi devices ship the aw87xxx amplifier with different firmware blobs. Select the firmware filename by DMI board/ product match so each device's blob coexists under /lib/firmware without collision, falling back to the original single filename when no match is found. This is deliberately an OGC-carried patch and must not be sent upstream. Co-developed-by: bouhaa <boukehaarsma23@gmail.com> Co-developed-by: Antheas Kapenekakis <git@antheas.dev> Signed-off-by: Hijae Song <hijae@naver.com>
linux/of_gpio.h has been removed from the tree. None of these files actually use anything from it (no of_gpio_* calls), so drop the dead include to fix the build. This is deliberately an OGC-carried patch and must not be sent upstream. Signed-off-by: Hijae Song <hijae@naver.com>
…mponent Newer kernels (6.16+) changed snd_soc_unregister_component()'s signature. Add a version-gated wrapper so the driver still builds across the kernel versions this branch needs to support. This is deliberately an OGC-carried patch and must not be sent upstream. Signed-off-by: Hijae Song <hijae@naver.com>
The valid-GPIO branch fell through without ever requesting the reset pin, leaving it unclaimed. Request it with devm_gpio_request_one() so the driver actually owns and can drive the reset line. This is deliberately an OGC-carried patch and must not be sent upstream. Signed-off-by: Hijae Song <hijae@naver.com>
The ALC269VB codec's internal speaker pin isn't configured correctly on the AyaNeo AIR 1S out of the box, so no audio plays even once the aw87xxx amplifier driver (added earlier in this branch) is working. Add a pin fixup matching the AIR 1S's PCI SSID that sets pin 0x1a to 0x90170110, restoring internal speaker output. This is deliberately an OGC-carried patch and must not be sent upstream. Co-developed-by: linh1987 (cherry picked from commit 89eb9630d9114c38f35edc4041daf8b1d25886d3) Signed-off-by: Hijae Song <hijae@naver.com>
d1c55aa to
a289bc0
Compare
|
@pastaq Rebased onto current The aw87xxx driver traces back to Diffed the rebuilt tree against the old squash to confirm it's functionally identical, and rebuilt both modules out-of-tree to confirm they still compile. |
Context
Several handhelds (AyaNeo Flip KB/DS, AIR 1S, AIR Plus, Kun; Ayn Loki MiniPro; Orange Pi NEO-01) use the Awinic AW87XXX Smart K PA as their speaker amplifier, identified over ACPI as AWDZ8830. Mainline Linux has no driver for this chip — the closest match (aw87390.c) doesn't recognize it. Without this driver these devices have no speaker output at all.
This driver was lost when Bazzite's kernel source switched to OGC, unrelated to the driver itself. See ublue-os/bazzite#5374 for the resulting regression report (AyaNeo AIR 1S, no audio since the kernel switch).
All commits in this PR are downstream-only carries and are tagged
[NOT-FOR-UPSTREAM]accordingly — none of this is intended to be sent to mainline Linux.Changes
Rebased onto current
features/ayaneo(no more unrelated commits pulled in via merge) and reconstructed as individual, properly-attributed commits instead of a squash:-x) from the real upstream source,ChimeraOS/linux(6.14/chimeraos), preserving each original author (Matthew Anderson, CVMagic, Bouke Sybren Haarsma).linux/of_gpio.hinclude (header no longer exists in this tree) so it builds on current kernels.snd_soc_unregister_component()so the driver still builds on newer (6.16+) kernels.devm_gpio_request_one()) in the valid-GPIO branch, which previously fell through without claiming the pin.-x) fromhhd-dev/patchwork(fewtarius, co-developed by linh1987) — needed in addition to the aw87xxx driver above, since the AIR 1S's main HDA codec pin routing isn't otherwise configured for internal speaker output.(Correction from the previous PR description: the aw87xxx driver itself comes from
ChimeraOS/linux, nothhd-dev/patchwork— only the AIR 1S pin fixup is fromhhd-dev/patchwork.)Testing
Built out-of-tree against this branch's exact source (kernel-devel 7.2.0-ogc4.1) and verified on real AyaNeo Flip KB hardware — chip probes correctly (chip_id 0x5a, product aw87559), and speaker audio works, including after a fresh reboot.
The AIR 1S pin fixup has been directly confirmed by @bl1nk: they built this exact commit against this PR branch and verified both internal speaker output and the module symbol names (
ALC269VB_FIXUP_AYANEO_SPKR_PIN_FIX,ayaneo-speaker-pin-fix) match what's in this PR (see comments below).All modules were also rebuilt out-of-tree here after the rebase (
snd-soc-aw87xxx.ko,snd-hda-codec-alc269.ko) to confirm they still compile cleanly and contain the same symbols.